package logic;

public class pos {

	private int x;
	private int y;
	public pos(int x, int y)
	{
		this.setX(x);
		this.setY(y);
	}
	public pos()
	{
		this.setX(-1);
		this.setY(-1);
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public boolean equals(Object o)
	{
		if(this.x == ((pos)o).getX() && this.y == ((pos)o).getY())
			return true;
		else return false;
		
	}
	public boolean adjacent(pos position)
	{
		if(this.x == position.x)
			if(Math.abs(this.y - position.y)==1)
				return true;
			else return false;
		else if(this.y == position.y)
			if(Math.abs(this.x - position.x)==1)
				return true;
			else return false;
		return false;
		
	}
}
